package org.example.logback;

import org.slf4j.MDC;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

@Component
public class TraceFilter implements Filter {
    private static final String LOG_EXT_TRACE_ID = "traceId";
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        try {
//            String traceId = TraceContext.traceId();
//            MDC.put(LOG_EXT_TRACE_ID, traceId);
            filterChain.doFilter(servletRequest, servletResponse);
//        } finally {
//            MDC.remove(LOG_EXT_TRACE_ID);
//        }

    }
}
